Skip to content

Add a test case to verify GARP behavior with out of subnet IPs#23320

Open
prabhataravind wants to merge 6 commits intosonic-net:masterfrom
prabhataravind:paravind/garp
Open

Add a test case to verify GARP behavior with out of subnet IPs#23320
prabhataravind wants to merge 6 commits intosonic-net:masterfrom
prabhataravind:paravind/garp

Conversation

@prabhataravind
Copy link
Copy Markdown
Contributor

@prabhataravind prabhataravind commented Mar 25, 2026

Description of PR

Add sonic-mgmt tests to verify GARP behavior in accordance with swss changes in sonic-net/sonic-swss#4383.

NOTE: This change is to be merged ONLY after the swss change above is merged and submodule is updated.

Summary:
Fixes # 37292328

Type of change

  • Bug fix
  • Testbed and Framework(new/improvement)
  • New Test case
    • Skipped for non-supported platforms
  • Test case improvement

Back port request

  • 202205
  • 202305
  • 202311
  • 202405
  • 202411
  • 202505
  • 202511

Approach

What is the motivation for this PR?

To verify expected behavior with the image change to arp_accept value.

How did you do it?

By adding new test cases and changing existing tests that look for arp_accept value of 1.

How did you verify/test it?

By running the tests on physical and kvm testbeds

Any platform specific information?

N/A

Supported testbed topology if it's a new test case?

T0/dualtor

Documentation

Please refer to the details of the change and motivation in the swss PR sonic-net/sonic-swss#4383.

@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

Signed-off-by: Prabhat Aravind <paravind@microsoft.com>
@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

Signed-off-by: Prabhat Aravind <paravind@microsoft.com>
@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

Signed-off-by: Prabhat Aravind <paravind@microsoft.com>
@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@prabhataravind
Copy link
Copy Markdown
Contributor Author

/azpw run Azure.sonic-mgmt

@mssonicbld
Copy link
Copy Markdown
Collaborator

⚠️ Notice: /azpw run only runs failed jobs now. If you want to trigger a whole pipline run, please rebase your branch or close and reopen the PR.
💡 Tip: You can also use /azpw retry to retry failed jobs directly.

Retrying failed(or canceled) jobs...

@mssonicbld
Copy link
Copy Markdown
Collaborator

No Azure DevOps builds found for #23320.

@prabhataravind
Copy link
Copy Markdown
Contributor Author

/azp run Azure.sonic-mgmt

@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

Copy link
Copy Markdown
Collaborator

@StormLiangMS StormLiangMS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@prabhataravind⚠️ Fixture semantic change + good new tests

Template: ✅ OK
DCO: ✅ signed
CI: ✅ all green

Code Review:

[Important] garp_enabled fixture: == 1== 2 breaks existing test semantics

conftest.py:229: The garp_enabled fixture yield changed from:

yield all(int(val) == 1 for val in arp_accept_vals)  # Before
yield all(int(val) == 2 for val in arp_accept_vals)  # After

This changes what garp_enabled means for the existing test test_arp_garp_enabled:

  • Before: garp_enabled=True meant arp_accept=1 (accept all GARPs)
  • After: garp_enabled=True means arp_accept=2 (accept same-subnet GARPs only)

The existing test_arp_garp_enabled test sends an in-subnet GARP, so it still passes with arp_accept=2. But if any other test or downstream code relies on garp_enabled meaning "arp_accept=1", it will silently break.

Suggestion: Add a comment explaining the semantic change, or rename the fixture to clarify (e.g., garp_accept_same_subnet). Also, what kernel version introduced arp_accept=2? Older kernels only support 0/1 — document the minimum kernel requirement.

[Minor] time.sleep(2) in multiple tests — consider wait_until or retry

Tests test_arp_garp_out_of_subnet_not_learned, test_ipv6_unsolicited_na_* all use time.sleep(2) before checking the ARP table. This is brittle — if the DUT is slow processing, the test fails. For positive tests (expecting entry to exist), a wait_until with retry would be more reliable.

For negative tests (expecting entry NOT to exist), time.sleep(2) is actually reasonable — you can't wait for something that shouldn't happen. But 2 seconds may be too short on slow platforms. Consider 5 seconds to be safe.

[Minor] clear_dut_arp_cache(duthost, is_ipv6=True) — verify function signature

The is_ipv6 parameter is used in 3 new IPv6 tests. Confirm clear_dut_arp_cache actually supports this kwarg — if it doesn't, the cache clear silently does nothing and the tests could give false positives.

Overall: Good new test coverage for arp_accept=2 semantics (in-subnet, out-of-subnet, IPv6 link-local, IPv6 in/out-subnet). The fixture change is the main concern.

Copy link
Copy Markdown
Collaborator

@StormLiangMS StormLiangMS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@prabhataravind — The garp_enabled fixture yield change from == 1 to == 2 silently alters the semantics for the existing test_arp_garp_enabled test and any downstream consumers of this fixture.

Please add a comment explaining that arp_accept=2 is the new expected value (same-subnet only), and document the minimum kernel version requirement (arp_accept=2 was added in Linux 5.18+). Consider renaming the fixture if the old semantics were "accept all GARPs" vs the new "accept same-subnet only".

@prabhataravind
Copy link
Copy Markdown
Contributor Author

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

Signed-off-by: Prabhat Aravind <paravind@microsoft.com>
@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@prabhataravind prabhataravind marked this pull request as ready for review March 29, 2026 18:34
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds SONiC mgmt ARP/NDP tests to validate new GARP behavior (same-subnet-only learning) aligned with the referenced swss change that programs arp_accept=2 when grat_arp is enabled.

Changes:

  • Add new extended ARP testcases for arp_accept value and out-of-subnet GARP / unsolicited NA learning behavior.
  • Update garp_enabled fixture to treat arp_accept=2 as the successful programmed state.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 9 comments.

File Description
tests/arp/test_arp_extended.py Adds new GARP/NDP learning tests (including out-of-subnet negative cases) and a sysctl validation test.
tests/arp/conftest.py Updates garp_enabled fixture to validate arp_accept==2 after enabling grat_arp.

Signed-off-by: Prabhat Aravind <paravind@microsoft.com>
@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@prabhataravind
Copy link
Copy Markdown
Contributor Author

@prabhataravind — The garp_enabled fixture yield change from == 1 to == 2 silently alters the semantics for the existing test_arp_garp_enabled test and any downstream consumers of this fixture.

Please add a comment explaining that arp_accept=2 is the new expected value (same-subnet only), and document the minimum kernel version requirement (arp_accept=2 was added in Linux 5.18+). Consider renaming the fixture if the old semantics were "accept all GARPs" vs the new "accept same-subnet only".

@StormLiangMS added a comment in the fixture and also added description that this goes with a corresponding swss change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants